package handler;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Vector;

public class BeanNameUrlHandler implements Controller {
    @Override
    /*
     * 处理HttpServlet请求并返回调度器服务将呈现的ModelAndView对象
     * ModelMap是@RequestMapping注解的方法的默认参数类型之一
     */
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        List<String> list = new Vector<>();
        list.add("姓名");
        list.add("性别");
        list.add("出生日期");
        list.add("籍贯");
        list.add("血型");
        // viewName：要渲染的视图的名称，由DispatcherServlet的ViewResolver解析
        ModelAndView modelAndView = new ModelAndView("one");
        modelAndView.addObject("personal information", list);
        modelAndView.addObject("message", "没有任何个人信息供显示");
        return modelAndView;
    }
}
